<template>
	<view class="content">
		<u--form class='form' labelPosition="top"
						labelWidth='100px' :model="form" ref="uForm">
			<u-form-item
					label="旧密码"
					prop="old_pass"
					borderBottom
					ref="item1"
			>
				<u--input
						type='password'
						v-model="form.old_pass"
						placeholder='请输入旧密码'
						border="none"
				></u--input>
			</u-form-item>
			<u-form-item
					label="新密码"
					prop="new_pass"
					borderBottom
					ref="item1"
			>
				<u--input
						type='password'
						v-model="form.new_pass"
						placeholder='请输入新密码'
						border="none"
				></u--input>
			</u-form-item>
			<u-form-item
					label="确认新密码"
					prop="re_new_pass"
					borderBottom
					ref="item1"
			>
				<u--input
						type='password'
						v-model="form.re_new_pass"
						placeholder='请输入确认新密码'
						border="none"
				></u--input>
			</u-form-item>
		</u--form>
		<view class="btn">
			<u-button class='btn' text="提交" type="primary" @click='submit'></u-button>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					old_pass: '',
					new_pass: '',
					re_new_pass: ''
				}
			}
		},
		methods: {
			submit(){
				var _this = this
				uni.request({
					url: 'http://www.yndzfl.cn/wxsite/Staff/setPassword',
					method: 'POST',
					header:{
						"Content-Type" : "application/x-www-form-urlencoded"
					},
					data: {
						token: uni.getStorageSync('token'),
						..._this.form
					},
					success(res) {
						console.log(res)
						if(res.data.code == 1){
							uni.reLaunch({
								url: '/pages/admin/login'
							})
						}else{
							
						}
						
					}
				})
			}
		}
	}
</script>

<style scoped>
.form{
	background: #fff;
	padding: 20px;
}
.btn{
	/* margin: 20px; */
	padding: 0 20px;
}
</style>
